<template>
	<view class="page">
		<image class="fs-full" src="/static/jc.png" mode="widthFix"></image>

		<view class="fs-full fs-py32">
			<fui-card>
				<fui-form ref="form0" labelWidth="200" labelColor='#666'>
					<city-picker v-model:city_id="formData.city_id" v-model:department_id="formData.department_id" />

					<fui-form-item label="战队">
						<fui-input v-model="formData.team" placeholder="请输入所在战队" :borderBottom="false"
							:padding="[0]"></fui-input>
					</fui-form-item>

					<fui-form-item label="签单人" asterisk>
						<fui-input v-model="formData.sign_person" placeholder="请输入签单人" :borderBottom="false"
							:padding="[0]"></fui-input>
					</fui-form-item>

					<signDatePicker v-model:sign_date="formData.sign_date" />

					<channelPicker v-model:channel_id="formData.channel_id" />
				</fui-form>
			</fui-card>
		</view>
	</view>
</template>

<script setup>
	import { inject, ref } from 'vue';
	import cityPicker from './city-picker.vue';
	import signDatePicker from './signDatePicker.vue';
	import channelPicker from './channelPicker.vue';

	const formData = inject('formData')

	const rules = [
		{ name: 'city_id', rule: ['required'], msg: ['请选择城市/部门'] },
		{ name: 'sign_person', rule: ['required'], msg: ['请输入签单人'] },
		{ name: 'sign_date', rule: ['required'], msg: ['请选择签单日期'] },
		{ name: 'channel_id', rule: ['required'], msg: ['请选择获客渠道'] },
	]

	const form0 = ref(null)
	defineExpose({ submit })
	async function submit() {
		const res = await form0.value.validator(formData.value, rules, )
		return res
	}
</script>

<style>
</style>